### 实例
### python3 get_xact_result.py /projects/analog_ip/workspace/xwqiu/cl/tacoma6/verify/xACT/inv_18_mac/t11.pex.netlist '[\"IN\", \"net1\", \"OUT\"]'


#### 功能
### 根据关键词，获取xact文件中对应的行，并写入到f.txt文件中，方便查看关键信号线 寄生参数

import sys
import json

afile = sys.argv[1]
#key_word = json.loads(sys.argv[2])

def get_result_bykey(myfile, key_word):
	mylist = []
	with open(myfile, 'r') as f:
		all_lines = f.readlines()
		for line in all_lines:
			for key in key_word:
				find_str = "NET "+key
				if find_str in line:
					mylist.append(line)
	with open("./f.txt", 'w') as f1:
		for i in mylist:
			f1.write(i)

#get_result(afile, key_word)


def get_result(myfile):
	mylist = []
	with open(myfile, 'r') as f:
		all_lines = f.readlines()
		for line in all_lines:
			find_str = "NET "
			if find_str in line:
				mylist.append(line)
	with open("./f.txt", 'w') as f1:
		for i in mylist:
			f1.write(i)
get_result(afile)